package com.Apo1o.controller;

import com.Apo1o.bean.QuarantineRegistration;
import com.Apo1o.bean.ext.QExt;
import com.Apo1o.response.Result;
import com.Apo1o.service.IQService;
import com.github.pagehelper.PageInfo;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Auther: Apo1o.
 * @Date: 2023/11/2-11-02-18:37
 * @Description： com.Apo1o.controller
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/quarantineRegistration")
public class QController {
    private final IQService iqService;
    @GetMapping
    public Result findAll(Integer pageNum, Integer pageSize, String grMechanism, String bQualified){
        PageInfo<QuarantineRegistration> all = iqService.findAll(pageNum, pageSize, grMechanism, bQualified);
        return Result.success(all);
    }

    @PostMapping("saveOrUpdate")
    public Result saveOrUpdate(@RequestBody QuarantineRegistration q){
        iqService.saveOrUpdate(q);
        return Result.success();
    }
    @DeleteMapping("deleteById/{grId}")
    public Result deleteById(@PathVariable Integer grId){
        iqService.deleteById(grId);
        return Result.success("删除成功");
    }

    @DeleteMapping("deleteByIdAll")
    public Result deleteByIdAll(List<Integer> list){
        iqService.deleteByIdAll(list);
        return Result.success("删除成功");
    }
}
